//
//  ZTimeOutOrderTreatedVC.m
//  DistributorAB
//
//  Created by LZY on 2019/10/16.
//  Copyright © 2019 主事丫环. All rights reserved.
//

#import "ZTimeOutOrderTreatedVC.h"
#import "ZTimeOutOrderDetailPersonCell.h"
#import "ZTimeOutOrderDetailElectricCell.h"
#import "ZTimeOutOrderDetailTreatedCell.h"

@interface ZTimeOutOrderTreatedVC () <UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;

@end

@implementation ZTimeOutOrderTreatedVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title = @"已处理";
    [self.leftbutton setImage:imgname(@"left_icon") forState:(UIControlStateNormal)];
    self.view.backgroundColor = kColorWithHex(0xf2f2f2);
    
    [self setupViewAction];
}

#pragma mark - 界面布局
- (void)setupViewAction{
    
    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, kNaviHeight, kScreen_Width, kScreen_Height - kNaviHeight) style:UITableViewStylePlain];
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    _tableView.backgroundColor = kColorWithHex(0xf2f2f2);
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.rowHeight = UITableViewAutomaticDimension;
    _tableView.estimatedRowHeight = 300;
    [self.view addSubview:_tableView];
    
    [_tableView registerClass:[ZTimeOutOrderDetailPersonCell class] forCellReuseIdentifier:NSStringFromClass([ZTimeOutOrderDetailPersonCell class])];
    [_tableView registerClass:[ZTimeOutOrderDetailElectricCell class] forCellReuseIdentifier:NSStringFromClass([ZTimeOutOrderDetailElectricCell class])];
    [_tableView registerClass:[ZTimeOutOrderDetailTreatedCell class] forCellReuseIdentifier:NSStringFromClass([ZTimeOutOrderDetailTreatedCell class])];
    
}
#pragma mark - UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 2;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        //个人家庭 、 电器厂
        if ([self.orderModel.user_type isEqualToString:@"0"]) {
            ZTimeOutOrderDetailPersonCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([ZTimeOutOrderDetailPersonCell class]) forIndexPath:indexPath];
            [cell setupBViewAction];
            cell.orderModel = self.orderModel;
            return cell;
        }else if ([self.orderModel.user_type isEqualToString:@"2"]){
            ZTimeOutOrderDetailElectricCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([ZTimeOutOrderDetailElectricCell class]) forIndexPath:indexPath];
            [cell setupBViewAction];
            cell.orderModel = self.orderModel;
            return cell;
        }else{
            return [UITableViewCell new];
        }
    }else if (indexPath.row == 1){
        ZTimeOutOrderDetailTreatedCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([ZTimeOutOrderDetailTreatedCell class]) forIndexPath:indexPath];
        cell.orderModel = self.orderModel;
        return cell;
    }else{
        return [UITableViewCell new];
    }
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
